<?php
namespace Home\Controller;
use Common\Controller\CommonController;

class MemberNoGjController extends CommonController {

    public function index()
    {
        $wd = I('wd');
        $map = [];
        if($wd){
            $map['member_no'] = ['like', "%{$wd}%"];
        }
        list($list, $page) = $this->lists('MemberNoGj', $map, 'id desc');
        if($list){
            if($user_ids = array_column($list, 'user_id')){
                $user_arr = M('user')->where(['id'=>['in', $user_ids]])->getField('id,nickname,phone');
            }else{
                $user_arr = [];
            }
            foreach ($list as $key => &$row) {
                if(isset($user_arr[$row['user_id']])){
                    $row['phone'] = $user_arr[$row['user_id']]['phone'];
                }else{
                    $row['phone'] = '';
                }
            }
        }
        $this->assign('page',$page);
        $this->assign('list', $list);
        $this->display();
    }
}